package com.jp.proxy.httpprocessor;

import java.util.Map;

/**
 * @ProjectName : HttpProcessor_20200413
 * @Author : Jason
 * @Time : 2021/8/29 15:42
 * @Description : 文件描述
 */
public class HttpHelper implements IHttpProcessor {


    private static final HttpHelper httpHelper = new HttpHelper();

    private HttpHelper() {

    }

    private IHttpProcessor iHttpProcessor;


    public static HttpHelper getInstance() {
        return httpHelper;
    }

    public void init(IHttpProcessor iHttpProcessor) {
        this.iHttpProcessor = iHttpProcessor;
    }

    @Override
    public void postRequest(String url, Map<String, Object> map, IRequestCallBack iRequestCallBack) {
        if (iHttpProcessor == null) {
            throw new NullPointerException("HttpHelper not invoke init method...");
        }
        iHttpProcessor.postRequest(url, map, iRequestCallBack);
    }

    @Override
    public void get(String url, Map<String, Object> params, IRequestCallBack callback) {

    }
}
